﻿using Shop.Collect;
using WeDonekRpc.Client.Attr;
using WeDonekRpc.Client.Interface;
using WeDonekRpc.Helper;

namespace Shop.LocalEvent.Category
{
    [LocalEventName("Delete")]
    internal class ClearFrontCategory : IEventHandler<CategoryLocalEvent>
    {
        private readonly IFrontCategoryBindCollect _FrontBind;

        public ClearFrontCategory (IFrontCategoryBindCollect frontBind)
        {
            this._FrontBind = frontBind;
        }

        public void HandleEvent (CategoryLocalEvent data, string eventName)
        {
            this._FrontBind.Clear(data.SubId.Add(data.Category.Id));
        }
    }
}
